package com.yiqi.news.mvp.contract

import com.jess.arms.mvp.IView
import com.jess.arms.mvp.IModel
import com.yiqi.news.entity.BaseResponse
import com.yiqi.news.entity.NewsResponse
import com.yiqi.news.entity.User
import io.reactivex.Observable


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 06/06/2019 13:47
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
interface LoginContract {
    //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
    interface View : IView {
        /*
          登录成功
         */
        fun showLoginSuccess(user: User)

        fun showLoginError(user: String)

        /*
          *   未绑定
          */
        fun showUnBind()

        /*
        * 获取验证码成功
        * */
        fun showCodeSuccess()

        fun showMobileError(msg: String)

    }

    //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
    interface Model : IModel {

        fun sendCode(phone: String): Observable<BaseResponse<User>>

        fun login(phone: String, code: String): Observable<BaseResponse<User>>
    }

}
